using Mysoft.Dbf.Writers;

namespace Mysoft.Dbf
{
    public class ExportAsCharacterColumnAttribute : ExportAsColumnAttributeBase
    {
        byte _totalLength;
        bool _truncateIfLonger;
        public ExportAsCharacterColumnAttribute(string columnName, byte totalSize, bool truncateIfLonger)
            : base(columnName)
        {
            _totalLength = totalSize;
            _truncateIfLonger = truncateIfLonger;
        }
        public ExportAsCharacterColumnAttribute(string columnName, byte totalSize)
            : this(columnName, totalSize, false)
        {
        }

        public override IWriter GetWriter()
        {
            return new CharacterFieldWriter(ColumnName, _totalLength, _truncateIfLonger);
        }
    }
}
